import { IsArray, IsNotEmpty, IsString, Length } from 'class-validator';

export class SigninUserDto {
  @IsString()
  @IsNotEmpty()
  @Length(4, 20, {
    message: '用户名字符长度必须在$constraint1到$constraint2之间',
  })
  username: string;

  @IsString()
  @IsNotEmpty()
  @Length(6, 20, {
    message: '密码长度必须在$constraint1到$constraint2之间',
  })
  password: string;

  @IsArray()
  roles: number[];
}

export class LoginUserDto {
  @IsString()
  @IsNotEmpty()
  @Length(4, 20, {
    message: '用户名字符长度必须在$constraint1到$constraint2之间',
  })
  username: string;

  @IsString()
  @IsNotEmpty()
  @Length(6, 20, {
    message: '密码长度必须在$constraint1到$constraint2之间',
  })
  password: string;
}
